package com.example.review;

import java.util.Scanner;

public class HanoiTest {
    private static int count;
    private static void  method(int n,char yuan,char fu,char tar){
        if(n == 1){
            System.out.println(yuan+"->"+tar);
            count++;
        }else {
            method(n-1,yuan,tar,fu);
            System.out.println(yuan+"->"+tar);
            method(n-1,fu,yuan,tar);
            count++;
        }

    }
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        method(n,'A','B','C');
        System.out.println(count);
    }
}
